<?php

namespace app\common\validate;

use app\common\utils\Is;
use taoser\Validate;

class OrderValidate extends Validate
{
    
    protected $rule = [
        // 'commission' => 'require|amount',
        'address' => 'require',
        'end_address' => 'require',
        'end_dept' => 'gt:0',
        'has_end_dept' => 'require',
        'shipper_name' => 'require',
        'shipper_mobile' => 'require|mobile',
        'shipper_type' => 'gt:0',
        'accept_name' => 'require',
        'accept_mobile' => 'require|mobile',
        'pay_type' => 'gt:0',
        'total_price' => 'require|float|amount',
        // 'total_price1' => 'require|float|amount',
        // 'total_price2' => 'require|float|amount',
        // 'total_price3' => 'require|float|amount',
        'car_brand' => 'require',
        'car_shelf_num' => 'require',
        'car_worth' => 'require|float',
        // 'car_color' => 'require',
        // 'car_number' => 'require',
        // 'car_goods' => 'require',
        // 'car_other' => 'require',
        'insure_type' => 'gt:0',
        'insure_price' => 'require|float',
        'contract' => 'require',
        'eta' => 'require',
        'collection_car_type'=>'gt:0'
    ];
    
    protected $message = [
        // 'commission.require' => '请输入业绩提成金额',
        // 'commission.amount' => '请输入正确业绩提成金额',
        'address.require' => '请选择起点位置',
        'end_address.require' => '请选择终点位置',
        'end_dept.gt' => '请选择终点',
        'has_end_dept.require' => '请选择是否有站',
        'shipper_name.require' => '请输入托运人姓名',
        'shipper_mobile.require' => '请输入托运人手机号码',
        'shipper_mobile.mobile' => '托运人手机号码有误',
        'shipper_type.gt' => '请选择托运人类别',
        'accept_name.require' => '请输入客户姓名',
        'accept_mobile.require' => '请输入客户手机号码',
        'accept_mobile.mobile' => '客户手机号码有误',
        'pay_type.gt' => '请选择付款方式',
        'collection_car_type'=>'请选择送车方式',
        'total_price.require' => '请输入运输费',
        'total_price.float' => '请输入正确运输费',
        // 'total_price1.require' => '请输入起运地预付款',
        // 'total_price1.float' => '请输入正确起运地预付款',
        // 'total_price2.require' => '请输入目的地结算',
        // 'total_price2.float' => '请输入正确目的地结算',
        // 'total_price3.require' => '请输入欠付运费',
        // 'total_price3.float' => '请输入正确欠付运费',
        'car_brand.require' => '请输入车辆名称',
        'car_shelf_num.require' => '请输入车辆识别码',
        'car_worth.require' => '请输入车辆价值',
        'car_worth.float' => '请输入正确车辆价值(万)',
        // 'car_color.require' => '请输入车辆颜色',
        // 'car_number.require' => '请输入车牌号码',
        // 'car_goods.require' => '请输入随车物品',
        // 'car_other.require' => '请输入其他说明',
        'insure_type.gt' => '请选择保价项目',
        'insure_price.require' => '请输入保险费',
        'insure_price.float' => '请输入正确保险费',
        'eta.require' => '请选择预计到达时间',
        'contract.require' => '请生成合同'
    ];
    
    protected function amount($value): bool
    {
        return Is::amount($value);
    }
    
    protected $scene = [
        'contract' => [
            'address', 'end_address', 'end_dept', 'shipper_name', 'shipper_mobile', 'shipper_type', 'accept_mobile', 'pay_type', 'total_price',
            'car_shelf_num', 'car_worth', 'has_end_dept', 'car_color', 'car_number', 'insure_type', 'insure_price', 'eta'
        ],
    ];


}